﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("-------欢 迎 进 入 游 戏 世 界-------");
            while (true)
            {
                Console.WriteLine("*******************************");
                Console.WriteLine("**********猜拳，开始***********");
                Console.WriteLine("*******************************");
                Console.WriteLine("出拳规则：1.剪刀 2.石头 3.布");
                Hero hero = HeroCreate();
                User user = UserCreate();
                bool IsStart = Start();
                if (!IsStart)
                {
                    Console.WriteLine("系统退出");
                    return;
                }
                else
                {
                    Console.WriteLine(hero.Name + " VS " + user.Name + "  对战");
                }

                GameSystem gm = new GameSystem();
                bool IsConutinue = gm.Gaming(hero, user);
                if (!IsConutinue)
                {
                    Console.WriteLine("系统退出");
                    return;
                }
            }
        }
       
        public static bool Start()
        {
            while (true)
            {
                Console.WriteLine("开始游戏吗？（y/n）");
                string chioce = Console.ReadLine();
                switch (chioce)
                {
                    case "y":
                        return true;
                    case "n":
                        return false;
                    default:
                        Console.WriteLine("选择错误，请重新输入");
                        continue;
                }
            }
        }
        public static Hero HeroCreate()
        {
            while (true)
            {
                Console.WriteLine("请选择对方角色<1.刘备 2.孙权 3.曹操>");
                Console.Write("请选择：");
                string chioce = Console.ReadLine();
                switch (chioce)
                {
                    case "1":
                        return new Hero("刘备");
                    case "2":
                        return new Hero("孙权");
                    case "3":
                        return new Hero("曹操");
                    default:
                        Console.WriteLine("选择错误，请重新输入");
                        continue;
                }
            }
        }
        public static User UserCreate()
        {

            Console.WriteLine("请输入您的姓名");
            string userName = Console.ReadLine();
            return new User(userName);
        }

    }
}
